#include "dpiscreen.h"

#include <QDesktopWidget>
#include <QApplication>
#include <QScreen>
#include <QDebug>

DPIScreen::DPIScreen(QObject *parent) :
    QObject(parent)
{
    getSizeScreen();
    getDPI();
}


void DPIScreen::getSizeScreen()
{
    QSize screenSize = QApplication::desktop()->availableGeometry().size();

    m_widthScreen = screenSize.width();
    m_heigthScreen = screenSize.height();

}

void DPIScreen::getDPI()
{
    QScreen *srn = QApplication::screens().at(0);
    int dotsPerInch = (int)srn->logicalDotsPerInch();
    qDebug() << "dotsPerInch: " << dotsPerInch;
    if(dotsPerInch <= 96){
        m_dpi = QString("ldpi");
    }else if( dotsPerInch <= 120){
        m_dpi = QString("mdpi");
    }else if( dotsPerInch <= 144)
    {
         m_dpi = QString("hdpi");
    }else if(dotsPerInch <= 192)
    {
         m_dpi = QString("xhdpi");
    }else
    {
         m_dpi = QString("xxhdpi");
    }


}
